import easygui
from bs4 import element
from selenium import webdriver
import random
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as ui
import time, datetime
from openpyxl import Workbook, load_workbook
from variable import *
import pyautogui
import os


def newqd():
    print("Case1开始执行，本条case，在pa【基础管理】-【渠道管理】创建新广告渠道！")
    qdm = paBl(1)
    browser = OpenBrowser()
    print(qdm)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/div")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/div")  # 点击【基础管理】
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[2]/label")  # 点击【渠道管理】
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[1]/form/div[4]/div/button")  # 点击【新增】
    time.sleep(1)
    BrowserClick(browser,
                 xpath="//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[1]/div/div/input")  # 点击【渠道名】文本框
    qdmName = BrowserUi(browser,
                        xpath="//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[1]/div/div/input")  # 定位文本框元素给UI对象
    qdmName.send_keys(qdm)  # 输入渠道名

    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[2]/div/div/input")
    qdmNumber = BrowserUi(browser,
                          xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[2]/div/div/input")
    qdmNumber.send_keys(qdm)  # 输入渠道号

    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[3]/div/button[2]")

    # time.sleep(3)
    GpsXpath(browser, xpath="//div[3]/button[2]/span")
    BrowserClick(browser, xpath="//div[3]/button[2]/span")
    print("！本次添加的渠道名，渠道号为：【", qdm, "】")
    print("本次调用已完成，5秒后自动关闭浏览器！")
    print("Case1执行完毕！\n")
    time.sleep(3)
    # 关闭当前窗口
    browser.close()  # 关闭当前窗口
    browser.quit()  # 退出浏览器


def newsl():
    print("Case2开始执行，本条case，在pa【数据抓取配置】-【自动抓取配置】创建【税率】扣除数据！")
    browser = OpenBrowser()
    GpsXpath(browser, xpath=".//li[6]/div")
    BrowserClick(browser, xpath="//li[6]/div")  # 点击【数据抓取配置】
    BrowserClick(browser, xpath="//li[6]/ul/li/label")  # 点击【自动抓取配置】
    GpsXpath(browser, xpath="//span[contains(.,'新增')]")
    BrowserClick(browser, xpath="//span[contains(.,'新增')]")  # 点击【新增】
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[1]/div/div/div[1]/input")  # 点击【渠道类型】
    ggqd = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[1]/div/div/div/input")
    ggqd.send_keys("广告渠道")
    ggqd.send_keys(Keys.ARROW_DOWN)
    ggqd.send_keys(Keys.ENTER)  # 点选【广告渠道】

    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[2]/div/div/div/input")  # 点击【广告平台】
    ggpt = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[2]/div/div/div/input")
    ggpt.send_keys("zkknumberA")  # 手动设置改这里数据
    time.sleep(2)
    ggpt.send_keys(Keys.ARROW_UP)
    bucket_text = browser.find_elements_by_xpath('html/body/div[4]/div[1]/div[1]/ul/li')[-1].get_attribute(
        'textContent')  # 取广告平台下拉选项数据,这行代码学了2小时，比较费劲，主要是elements跟element不一样，可以返回多个对象
    print("！本次税率关联的广告平台是：", bucket_text)
    ggpt.send_keys(Keys.ENTER)  # 点选【广告平台】
    GpsXpath(browser,
             xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[3]/div/div/div[1]/input")

    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[3]/div/div/div[1]/input")  # 点击【用户】
    username = BrowserUi(browser,
                         xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[3]/div/div/div[1]/input")
    username.send_keys("zhoukangkang@aliyun.com")
    username.send_keys(Keys.ARROW_DOWN)
    username.send_keys(Keys.ENTER)  # 点选【用户名】

    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[4]/div/div[1]/textarea")  # 点击【广告平台配置】
    ggptpz = BrowserUi(browser,
                       xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[4]/div/div[1]/textarea")
    ggptpz.send_keys("Cookie:PHPSESSID=60p5efc776p3oukfn8bjpun2kb")  # 输入【广告平台配置】，不知道干什么用的，但是这个必填，复制之前的测试数据

    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[8]/div/div/input")  # 点击【广告平台配置】
    rwkssj = BrowserUi(browser,
                       xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[8]/div/div/input")
    time.sleep(1)
    rwkssj.send_keys(Keys.ENTER)

    time.sleep(2)
    BrowserClick(browser,
                 xpath="//div[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[10]/div/div/input")  # 点击【税率】
    sl = BrowserUi(browser,
                   xpath="//div[@id='app']/div/div[2]/section/div/section/div[4]/div/div[2]/form/div[10]/div/div/input")
    sl.send_keys(Keys.BACKSPACE)
    sl.send_keys("9.72")  # 输入【税率】
    print("本次设置的税率为：9.72")
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[4]/div/div[3]/div/button[2]")  # 点击【提交】按钮
    GpsXpath(browser, xpath="//span[contains(.,'确定')]")
    BrowserClick(browser, xpath="//span[contains(.,'确定')]")
    print("Case2执行完毕！\n")
    time.sleep(3)
    browser.close()  # 关闭所有已经打开的窗口
    browser.quit()  # 退出浏览器


def GameMapping():
    print("Case3开始执行，本条case，在pa【数据抓取配置】-【游戏映射】创建创建游戏映射！")
    browser = OpenBrowser()
    GpsXpath(browser, xpath=".//li[6]/div")
    # wait = ui.WebDriverWait(browser, 5)  # 软等待，页面ui加载，最高5秒，等待这个元素，直到加载完成，限制最长等待5秒内
    # wait.until(lambda browser:
    #            browser.find_element_by_xpath(".//li[6]/div").is_displayed())
    BrowserClick(browser, xpath="//li[6]/div")  # 点击【数据抓取配置】
    GpsXpath(browser, xpath="//li[6]/ul/li[3]/label")
    BrowserClick(browser, xpath="//li[6]/ul/li[3]/label")  # 点击【游戏映射】
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/section/div/section/div[1]/form/div[6]/div/button")
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[1]/div/div/div/input")
    game = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[1]/div/div/div/input")
    time.sleep(1)
    game.send_keys(Keys.ARROW_UP)
    game.send_keys(Keys.ENTER)  # 选择最下边的一个游戏，是最新提交的一个游戏
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[3]/div/div/div/input")
    qdlx = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[3]/div/div/div/input")
    time.sleep(1)
    qdlx.send_keys(Keys.ARROW_DOWN)
    qdlx.send_keys(Keys.ENTER)  # 选择渠道类型
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[4]/div/div/div/input")
    ggpt = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[4]/div/div/div/input")
    time.sleep(1)
    ggpt.send_keys(Keys.ARROW_UP)
    ggpt.send_keys(Keys.ENTER)  # 选择广告平台
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[5]/div/div/div/input")
    user = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[5]/div/div/div/input")
    time.sleep(1)
    user.send_keys(Keys.ARROW_DOWN)
    user.send_keys(Keys.ENTER)  # 选择用户
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[6]/div/div/input")
    qdfGameId = BrowserUi(browser,
                          xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[6]/div/div/input")
    gameid = GameId()
    print("本次游戏映射的游戏id为：", gameid)
    qdfGameId.send_keys(gameid)
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[7]/div/div/input")
    qdfGameName = BrowserUi(browser,
                            xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[7]/div/div/input")
    qdfGameName.send_keys(gameid)  # 渠道方游戏名称，这里用跟渠道方游戏id一样的参数，后期好填写配置
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[8]/div/div/input")
    qdfGameName = BrowserUi(browser,
                            xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[8]/div/div/input")
    qdfGameName.send_keys("100")  # 附加扣除100%，即不扣除，写多少就给多少，不是写多少扣多少
    time.sleep(1)
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[8]/div/div/input")
    smzq = BrowserUi(browser,
                     xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[2]/form/div[9]/div/div/input")
    smzq.send_keys("1")  # 生命周期填写1，具体参数意义不清楚
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/section/div/section/div[5]/div/div[3]/div/button[2]")
    GpsXpath(browser, xpath="//div[3]/button[2]/span")
    BrowserClick(browser, xpath="//div[3]/button[2]/span")
    print("Case3执行完毕！\n")
    time.sleep(3)
    # 关闭当前窗口
    browser.close()
    # 关闭所有已经打开的窗口
    browser.quit()


def adv(enter=None):
    print("Case4开始执行，本条case，修改数据模板日期，在【数据抓取配置】-【手动上传配置】上传广告文件")
    OpenExcel()
    browser = OpenBrowser()
    GpsXpath(browser, xpath=".//li[6]/div")
    BrowserClick(browser, xpath="//li[6]/div")  # 点击【数据抓取配置】
    GpsXpath(browser, xpath="//li[6]/ul/li[4]/label")
    BrowserClick(browser, xpath="//li[6]/ul/li[4]/label")  # 点击【手动上传配置】
    GpsXpath(browser,
             xpath=".//*[@id='app']/div/div[2]/section/div/section/div[1]/form/div[5]/div/div/div/button")  # 定位上传按钮
    BrowserClick(browser,
                 xpath=".//*[@id='app']/div/div[2]/section/div/section/div[1]/form/div[5]/div/div/div/button")  # 点击上传按钮

    #############################操作本地选择广告收入模板
    time.sleep(1)
    localUpLoad = "E:\\20190810_sjmb"
    pyautogui.typewrite(localUpLoad)
    pyautogui.keyDown('enter')
    pyautogui.keyUp('enter')
    pyautogui.keyDown('enter')
    pyautogui.keyUp('enter')
    """用pyautogui库进行的纯键盘输入模拟，效果目前能满足需求，由于控件不是纯file类型，无法用现成的webdriver调用输入本地文件地址"""
    #####################################################

    print("Case4执行完毕！\n")
    time.sleep(3)
    browser.close()  # 关闭所有已经打开的窗口
    browser.quit()  # 退出浏览器


def TraversalClick():
    print("Case5开始执行，本条case,遍历点击PA平台所有菜单！")
    browser = OpenBrowser()
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/div")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/div")  # 点击【基础管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[1]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[1]")  # 点击【基础管理】-【游戏管理列表】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[2]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[2]")  # 点击【基础管理】-【渠道管理列表】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[3]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[2]/ul/li[3]")  # 点击【基础管理】-【广告管理列表】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/div")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/div")  # 点击【权限管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[1]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[1]")  # 点击【权限管理】-【角色权限管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[2]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[2]")  # 点击【权限管理】-【角色管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[3]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[3]")  # 点击【权限管理】-【操作日志管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[4]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[4]")  # 点击【权限管理】-【游戏组管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[5]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[5]")  # 点击【权限管理】-【有归属管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[6]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[6]")  # 点击【权限管理】-【同步数据】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[7]")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[3]/ul/li[7]")  # 点击【权限管理】-【默认值管理】
    time.sleep(2)
    GpsXpath(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[4]/div")
    BrowserClick(browser, xpath=".//*[@id='app']/div/div[2]/ul/li[4]/div")  # 点击【合作伙伴】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[1]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[1]")  # 点击【合作伙伴】-【账号审核】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[2]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[2]")  # 点击【合作伙伴】-【邮件推送】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[3]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[3]")  # 点击【合作伙伴】-【用户创建】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[4]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[4]")  # 点击【合作伙伴】-【备用邮件管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[5]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[5]")  # 点击【合作伙伴】-【邮件组管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[6]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[6]")  # 点击【合作伙伴】-【游戏审核】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[7]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[7]")  # 点击【合作伙伴】-【游戏详情】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[8]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[8]")  # 点击【合作伙伴】-【资料导出】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[9]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[9]")  # 点击【合作伙伴】-【邮件模板】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[10]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[10]")  # 点击【合作伙伴】-【广告key管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[11]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[4]/ul/li[11]")  # 点击【合作伙伴】-【分成管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/div")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/div")  # 点击【游戏管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[1]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[1]")  # 点击【游戏管理】-【在线参数】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[2]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[2]")  # 点击【游戏管理】-【老广告管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[3]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[3]")  # 点击【游戏管理】-【区域映射管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[4]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[4]")  # 点击【游戏管理】-【广告管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[5]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[5]")  # 点击【游戏管理】-【版本管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[6]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[6]")  # 点击【游戏管理】-【进账或推广渠道管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[7]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[7]")  # 点击【游戏管理】-【分区管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[8]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[8]")  # 点击【游戏管理】-【SDK在线参数配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[9]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[9]")  # 点击【游戏管理】-【操作记录】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[10]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[5]/ul/li[10]")  # 点击【游戏管理】-【测试设备管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/div")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/div")  # 点击【数据抓取配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[1]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[1]")  # 点击【数据抓取配置】-【自动抓取配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[2]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[2]")  # 点击【数据抓取配置】-【进账渠道配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[3]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[3]")  # 点击【数据抓取配置】-【游戏映射】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[4]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[4]")  # 点击【数据抓取配置】-【手动上传配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[5]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[5]")  # 点击【数据抓取配置】-【任务记录】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[6]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[6]")  # 点击【数据抓取配置】-【手动操作】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[7]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[6]/ul/li[7]")  # 点击【数据抓取配置】-【国家管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/div")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/div")  # 点击【打包管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[1]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[1]")  # 点击【打包管理】-【SDK配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[2]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[2]")  # 点击【打包管理】-【计费点配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[3]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[3]")  # 点击【打包管理】-【打包配置】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[4]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[4]")  # 点击【打包管理】-【打包结果】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[5]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[5]")  # 点击【打包管理】-【包管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[6]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[6]")  # 点击【打包管理】-【测试通过列表】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[7]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[7]")  # 点击【打包管理】-【二次签名包列表】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[8]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[8]")  # 点击【打包管理】-【管理SDK】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[9]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[9]")  # 点击【打包管理】-【管理SDK版本】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[10]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[10]")  # 点击【打包管理】-【绑定SDK版本】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[11]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[11]")  # 点击【打包管理】-【计费渠道管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[12]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[12]")  # 点击【打包管理】-【渠道角标与闪屏页管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[13]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[13]")  # 点击【打包管理】-【渠道默认值管理】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[14]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[14]")  # 点击【打包管理】-【发布渠道关联SDK】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[15]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[15]")  # 点击【打包管理】-【SDK互斥】
    time.sleep(2)
    GpsXpath(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[16]")
    BrowserClick(browser, xpath="//*[@id='app']/div/div[2]/ul/li[7]/ul/li[16]")  # 点击【打包管理】-【广告快速配置】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/div')  # 点击【收入信息】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/ul/li[1]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/ul/li[1]')  # 点击【收入信息】-【收入总览】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/ul/li[2]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[8]/ul/li[2]')  # 点击【收入信息】-【收入报表】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/div')  # 点击【激活码管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[1]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[1]')  # 点击【激活码管理】-【物品管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[2]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[2]')  # 点击【激活码管理】-【礼包管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[3]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[9]/ul/li[3]')  # 点击【激活码管理】-【激活码管理列表】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/div')  # 点击【自主发行管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/ul/li[1]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/ul/li[1]')  # 点击【自主发行管理】-【渠道提交资料配置】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/ul/li[2]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[10]/ul/li[2]')  # 点击【自主发行管理】-【Yodo1标示配置】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[11]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[11]/div')  # 点击【RevenueX管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[11]/ul/li')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[11]/ul/li')  # 点击【RevenueX管理】-【游戏配置】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/div')  # 点击【结算相关管理】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[1]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[1]')  # 点击【结算相关管理】-【支付结果】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[2]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[2]')  # 点击【结算相关管理】-【提现同步结果】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[3]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[12]/ul/li[3]')  # 点击【结算相关管理】-【开发者账号余额】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[13]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[13]/div')  # 点击【客服支持】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[13]/ul/li')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[13]/ul/li')  # 点击【客服支持】-【支付订单查询】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/div')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/div')  # 点击【错误收集】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/ul/li[1]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/ul/li[1]')  # 点击【错误收集】-【客户端错误】
    time.sleep(2)
    GpsXpath(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/ul/li[2]')
    BrowserClick(browser, xpath='//*[@id="app"]/div/div[2]/ul/li[14]/ul/li[2]')  # 点击【错误收集】-【服务端错误】
    print("Case5执行完毕！\n")
    time.sleep(3)
    browser.close()  # 关闭所有已经打开的窗口
    browser.quit()  # 退出浏览器
